<!DOCTYPE html>
<html class="x-admin-sm" xmlns:th="http://www.thymeleaf.org">
    
    <head>
        <meta charset="UTF-8">
        <title></title>
<!--        <meta name="renderer" content="webkit">-->
<!--        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">-->
<!--        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />-->
        <link rel="stylesheet"  th:href="@{/X-admin/css/font.css}">
        <link rel="stylesheet" th:href="@{/X-admin/css/xadmin.css}">
        <script th:src="@{/X-admin/lib/layui/layui.js}" charset="utf-8"></script>
        <script type="text/javascript" th:src="@{/X-admin/js/xadmin.js}"></script>
    </head>
    
    <body>
        <div class="x-nav">
            <span class="layui-breadcrumb">
                <a href="#">首页</a>
                <a href="#">演示</a>
                <a>
                    <cite>导航元素</cite></a>
            </span>
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
                <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
            </a>
        </div>
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div th:if="${ceremonyOpen!=null}">
                            <br><br>
                            <br>
                        <div style="text-align: center">
                            <h3>*太原理工大学春季运动会开幕式*</h3>
                        </div>
                        <div class="layui-card-body ">
                            <table class="layui-table layui-form">
                                <thead>
                                    <tr>
                                        <th>开幕式编号</th>
                                        <th>开幕式名称</th>
                                        <th>开始时间</th>
                                        <th>结束时间</th>
                                        <th>地点</th>
                                        <th>发言人</th>
                                        <th>操作</th></tr>
                                </thead>
                                <tbody>
                                    <tr >
                                        <td th:text="${ceremonyOpen.getCeremonyId()}"></td>
                                        <td th:text="${ceremonyOpen.getCeremonyName()}"></td>
                                        <td th:text="${ceremonyOpen.getCeremonyStartTime()}"></td>
                                        <td th:text="${ceremonyOpen.getCeremonyEndTime()}"></td>
                                        <td th:text="${ceremonyOpen.getCeremonyPlace()}"></td>
                                        <td th:text="${ceremonyOpen.getCeremonyHost()}"></td>

                                        <td class="td-manage">
                                            <a title="查看" class="updCeremonyOpen"  href="javascript:;">
                                                <i class="layui-icon">&#xe63c;</i></a>
                                            <a title="删除" class="delCeremonyOpen" onclick="member_del(this,'要删除的id')" href="javascript:;">
                                                <i class="layui-icon">&#xe640;</i></a>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                        </div>

                        <div th:if="${ceremonyOpen==null}">
                            <br><br><br><br>
                            <br>
                            <br>
                            <div class="layui-card-header" style="text-align: center">
                                当前还没有添加开幕式，您可以
                                <a style="color: blue" onclick="xadmin.open('添加开幕式','/admin/toAddCeremonyOpen',500,600)">
                                    <i class="layui-icon">去添加开幕式</i></a>
                            </div>

                        </div>

                    </div>
                </div>
            </div>
        </div>
    </body>
    <script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
    <script type="text/javascript">


    </script>

    <script>
        $(".updCeremonyOpen").click(function () {
            //layer.alert("点击事件");
            var ceremonyId= $(this).parents("tr").find("td:eq(0)").text();
            $(this).attr("onclick",xadmin.open('修改','/admin/toUpdCeremonyOpen/'+ceremonyId,500,600));
        })


        layui.use(['laydate', 'form'],
        function() {
            var laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render({
                elem: '#start' //指定元素
            });

            //执行一个laydate实例
            laydate.render({
                elem: '#end' //指定元素
            });
        });

        /*用户-删除*/
        $(".delCeremonyOpen").click(function () {
            //layer.alert("点击事件");
            var ceremonyId= $(this).parents("tr").find("td:eq(0)").text();
            $(this).attr("onclick",member_del(this,ceremonyId));
        })
        var ceremonyId= $(this).parents("tr").find("td:eq(0)").text();
        function member_del(obj, ceremonyId) {
            layer.confirm('确认要删除吗？',
            function(index) {
                //发异步删除数据
                $.ajax({
                    //async:false,
                    url:"/admin/delCeremony/"+ceremonyId,
                    type:"DELETE",
                    success:function () {
                        //$(obj).parents("tr").remove();

                        layer.alert('已删除!', {
                            icon: 1,
                            time: 1000
                        });
                        setTimeout(function () {
                            window.location.reload();
                        }, 2000);
                    }
                })

            });
        }

    </script>

</html>